package com.xpjhs.menu.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.*;

/**
 * 
 * @ClassName:Menu
 * @Description:{todo
 * @author luckyboyguo@126.com
 * @date:2015年1月19日上午9:28:09
 */
@Entity
@Table(name="xpjhs_menu")
public class Menu implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private List<Menu> children;// 子菜单
	private String description;// 描述
	private boolean divider;//分割线
	private String iconUrl;// 图标
	private long id;
	private Integer level;// 菜单级别，从1开始。
	private boolean mainMenu; // 是否是主菜单
	private Integer orderNumber = 0; // 排序
	private Menu parent;// 父菜单
	private String permission;// 权限（1对1唯一）
	private String sign;// 菜单标识，用于当前选中菜单的高亮显示
	private String title;// 标题
	private String url;// 功能链接
	@OneToMany(mappedBy = "parent")
	public List<Menu> getChildren() {
		return children;
	}
	public String getDescription() {
		return description;
	}
	public String getIconUrl() {
		return iconUrl;
	}
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getId() {
		return id;
	}
	@Column(name="levels")
	public Integer getLevel() {
		return level;
	}
	public Integer getOrderNumber() {
		return orderNumber;
	}
	@ManyToOne
	@JoinColumn(name = "parent_id")
	public Menu getParent() {
		return parent;
	}
	public String getPermission() {
		return permission;
	}
	public String getSign() {
		return sign;
	}
	public String getTitle() {
		return title;
	}
	public String getUrl() {
		return url;
	}
	public boolean isDivider() {
		return divider;
	}
	public boolean isMainMenu() {
		return mainMenu;
	}
	public void setChildren(List<Menu> children) {
		this.children = children;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public void setDivider(boolean divider) {
		this.divider = divider;
	}
	public void setIconUrl(String iconUrl) {
		this.iconUrl = iconUrl;
	}
	public void setId(long id) {
		this.id = id;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	public void setMainMenu(boolean mainMenu) {
		this.mainMenu = mainMenu;
	}
	public void setOrderNumber(Integer orderNumber) {
		this.orderNumber = orderNumber;
	}
	public void setParent(Menu parent) {
		this.parent = parent;
	}
	public void setPermission(String permission) {
		this.permission = permission;
	}
	public void setSign(String sign) {
		this.sign = sign;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public void setUrl(String url) {
		this.url = url;
	}
}
